package com.suarte.core;

import com.suarte.utils.Persistent;
import org.appfuse.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * @date   Dec 30, 2010
 * @author Ggutierrez
 */
@Entity
@Table(name = "sa_resolutions")
public class Resolution extends BaseObject implements Persistent {

    private Long id;
    private String description;
    private Long oldId;

    public Resolution() {
    }

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "RESOLUTION_SEQ")
    @SequenceGenerator(name = "RESOLUTION_SEQ", sequenceName = "RESOLUTION_SEQ", allocationSize = 1)
    public Long getId() {
        return id;
    }

    @Column(name = "description", length = 100)
    public String getDescription() {
        return description;
    }

    @Column(name = "old_id")
    public Long getOldId() {
        return oldId;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setOldId(Long oldId) {
        this.oldId = oldId;
    }

    @Override
    public String toString() {
        return description;
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if (!(other instanceof Resolution)) {
            return false;
        }
        Resolution _i = (Resolution) other;
        return id.equals(_i.id);
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }
}
